﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace RayTracing
{
    public partial class AntiAliasingForm : Form
    {
        public AntiAliasingForm()
        {
            InitializeComponent();
        }
        private void passesButton_Click(object sender, EventArgs e)
        {
            passesText_TextChanged();
        }
        private void passesBar_ValueChanged(object sender, EventArgs e)
        {
            int temp = passesBar.Value;
            passesText.Text = " " + temp;
            displayBar.Maximum = temp;
        }
        private void passesText_TextChanged()
        {
            int temp = 1;
            try
            {
                 temp = int.Parse(passesText.Text);
            }
             catch(Exception ex)
            {
                temp = 0;
                passesText.Text = "0";
            }
            Main.passes = temp;
        }
        private void displayButton_Click(object sender, EventArgs e)
        {
            displayText_TextChanged();
        }
        private void displayBar_ValueChanged(object sender, EventArgs e)
        {
            int temp = displayBar.Value;
            if (temp > int.Parse(passesText.Text)) { temp = int.Parse(passesText.Text); }
            displayText.Text = " " + temp;
        }
        private void displayText_TextChanged()
        {
            int temp = 0;
            try
            {
                temp = int.Parse(displayText.Text);
                if (temp > int.Parse(passesText.Text)) { temp = int.Parse(passesText.Text); }
            }
            catch (Exception ex)
            {
                temp = 0;
                displayText.Text = "0";
            }
            Main.displayPasses = temp;
            //if (temp != 0) { Main.previewOn = true; }
            //else { Main.previewOn = false; }
        }
    }
}
//if (displayNo)
//{
//    if (displayCount == displayPasses)
//    {
//        displayCount = 0;
//        gridNormalize();
//        pictureBox1.Invalidate();
//    }
//    displayCount++;
//}     // Console.WriteLine("Count " + displayCount);

//for (int i = 2; i <= passes; i++)
//{
//    if (displayCount != 0)
//    {
//        if ((displayPasses % displayCount) == 0)
//        {
//            pictureBox1.Invalidate();
//            displayCount = 0;
//        }
//    }
//    shootFrame(i);
//    displayCount++;
//}
